/*
package com.thread.threadfirst.marvel.citymaster.aspect;

import com.fugui.marvel.service.citymaster.annotation.DistributedLock;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;
import java.util.Objects;

@Aspect
@Component
public class DistributedLockAspect {

    */
/**
     * 层切点
     *//*

    @Pointcut("@annotation(com.fugui.marvel.service.citymaster.annotation.DistributedLock)")
    public void distributedLockAspect() {
    }

    */
/**
     * 主要写一些锁的获取，和业务逻辑执行，锁的删除等
     *
     * @param joinPoint 切点
     * @return Object 添加分布式锁后，实际调用业务逻辑部分代码的返回值
     * @throws Throwable 产生的所有异常，为了避免对异常处理流程产生干扰，所有异常都应该继续抛出
     *//*

    @Around("distributedLockAspect()")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        DistributedLock distributedLock = getDistributedLock(joinPoint);
        if (Objects.isNull(distributedLock)) {
            //获取锁
            //tryGetDistributedLock
        }
        //执行方法，并获取返回值
        Object result = joinPoint.proceed();
        //释放锁
        //releaseDistributedLock
        return result;
    }


    */
/**
     * 获取 DistributedLock 注解
     *
     * @param joinPoint
     * @return 代码中定义的注解
     * @throws NoSuchMethodException
     *//*

    private static DistributedLock getDistributedLock(ProceedingJoinPoint joinPoint)
            throws NoSuchMethodException {
        String methodName = joinPoint.getSignature().getName();

        Class<?> classTarget = joinPoint.getTarget().getClass();
        Class<?>[] par = ((MethodSignature) joinPoint.getSignature()).getParameterTypes();
        Method objMethod = classTarget.getMethod(methodName, par);
        return objMethod.getAnnotation(DistributedLock.class);
    }

}




*/
